<div class="subnav subnav-fixed">
    <ul class="nav nav-pills">
        <li class="<?if($post_action=='NEW' )echo 'active';?>"><a href="<?=base_url('owners/view_new?post_type=owner')?>">Novi vlasnik</a></li>
        <li class=""><a href="<?=base_url('owners/view_all?post_type=owner')?>">Svi vlasnici</a></li>
        <li class=""><a href="javascript:" id="fill_form">Popuni formu</a></li>
    </ul>
</div>

<div class="container">

    <div class="page-header">
        <div class="row">
            <h1 class="span8"><? if($post_action=='EDIT'){ echo 'Ažuriranje vlasnika';}else echo 'Novi vlasnik';?></h1>
            <div class="span4"></div>           
        </div>
    </div> 

    <ul class="breadcrumb">
        <li>
            <a href="<?=base_url()?>">Home</a> <span class="divider">/</span>
        </li>
        <li>
            <a href="<?=base_url('owners/view_all?post_type=owner')?>">Vlasnici</a> <span class="divider">/</span>
        </li>
        <li class="active"><? if($post_action=='EDIT'){ echo 'Ažuriranje vlasnika';}else echo 'Novi vlasnik';?></li>
    </ul>

    <?//$this->firephp->log($post);?>

    <form class="form-horizontal" id="post" method="post" action="<?=base_url()?>owners/submit_post" name="post">

        <input type="hidden" value="<?=$post_type;?>" name="post_type" id="post_type">
        <input type="hidden" value="<?=$post_action;?>" name="post_action" id="post_action">                    
        <? if($post_action=='EDIT'){?><input type="hidden" value="<?=$post['ID'];?>" name="post_ID" id="post_ID"><?}?>


        <div class="group">

            <span class="group-title">GENERAL</span>

            <div class="row">

                <div class="span6">         

                    <fieldset>

                        <div class="control-group">
                            <label class="control-label">Company / Person</label>
                            <div class="controls">
                                <label class="radio inline">
                                    <input type="radio" <?if($post_action=='EDIT' && $post['company_person']=='company')echo 'checked="checked"';?> value="company" name="company_person" id="company_person-company" tabindex="1">
                                    Company
                                </label>
                                <label class="radio inline">
                                    <input type="radio" <?if($post_action=='EDIT' && $post['company_person']=='person')echo 'checked="checked"';?> value="person" name="company_person" id="company_person-person"  tabindex="2">
                                    Person
                                </label>
                            </div>
                        </div>

                        <div class="control-group">

                            <label class="control-label">Name</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="name" id="name" value="<?if($post_action=='EDIT')echo $post['name'];?>" tabindex="6">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Personal ID</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="personal_ID" id="personal_ID" value="<?if($post_action=='EDIT')echo $post['personal_ID'];?>" tabindex="8">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Birth date</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="birthdate" id="birthdate" value="<?if($post_action=='EDIT')echo date('d.m.Y',$post['birthdate']);?>" tabindex="10">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Pasport number</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="pasport_number" id="pasport_number" value="<?if($post_action=='EDIT')echo $post['pasport_number'];?>" tabindex="12">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Sex</label>

                            <div class="controls docs-input-sizes">

                                <select class="span2" name="sex" id="sex" tabindex="14">
                                    <option value="male">Male</option>
                                    <option value="femaile">Femaile</option>                                
                                </select>

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Language</label>

                            <div class="controls docs-input-sizes">

                                <select class="span3" name="language" id="language" tabindex="15">
                                    <option value="0">- Please select</option>
                                    <option value="Afrikaans">Afrikaans</option>  
                                    <option value="Albanian">Albanian</option>  
                                    <option value="Arabic">Arabic</option>  
                                    <option value="Belarusian">Belarusian</option>  
                                    <option value="Bulgarian">Bulgarian</option>  
                                    <option value="Catalan">Catalan</option>  
                                    <option value="Chinese">Chinese</option>  
                                    <option value="Croatian">Croatian</option>  
                                    <option value="Czech">Czech</option>  
                                    <option value="Danish">Danish</option>  
                                    <option value="Dutch">Dutch</option>  
                                    <option value="English">English</option>  
                                    <option value="Estonian">Estonian</option>  
                                    <option value="Filipino">Filipino</option>  
                                    <option value="Finnish">Finnish</option>  
                                    <option value="French">French</option>   
                                    <option value="German">German</option>  
                                    <option value="Greek">Greek</option>  
                                    <option value="Hungarian">Hungarian</option>  
                                    <option value="Icelandic">Icelandic</option>  
                                    <option value="Indonesian">Indonesian</option>  
                                    <option value="Irish">Irish</option>  
                                    <option value="Italian">Italian</option>  
                                    <option value="Japanese">Japanese</option>  
                                    <option value="Korean">Korean</option>  
                                    <option value="Latvian">Latvian</option>  
                                    <option value="Lithuanian">Lithuanian</option>  
                                    <option value="Macedonian">Macedonian</option>  
                                    <option value="Malay">Malay</option>  
                                    <option value="Maltese">Maltese</option>  
                                    <option value="Montenegrin">Montenegrin</option>  
                                    <option value="Norwegian">Norwegian</option>  
                                    <option value="Polish">Polish</option>  
                                    <option value="Portuguese">Portuguese</option>  
                                    <option value="Romanian">Romanian</option>  
                                    <option value="Russian">Russian</option>  
                                    <option value="Serbian">Serbian</option>  
                                    <option value="Slovak">Slovak</option>  
                                    <option value="Slovenian">Slovenian</option>  
                                    <option value="Spanish">Spanish</option>  
                                    <option value="Swedish">Swedish</option>  
                                    <option value="Turkish">Turkish</option>  
                                    <option value="Ukrainian">Ukrainian</option>  
                                    <option value="Vietnamese">Vietnamese</option>                               
                                </select>

                            </div>

                        </div>

                    </fieldset>

                </div>

                <div class="span6">

                    <fieldset>

                        <div class="control-group">
                            <label for="inlineCheckboxes" class="control-label">Type</label>
                            <div class="controls">
                                <label class="checkbox inline">
                                    <input type="checkbox" value="customer" name="owner_type[]" id="owner_customer" <?if($post_action=='EDIT' && $post['customer']==1)echo 'checked="checked"';?> tabindex="3"> Customer
                                </label>
                                <label class="checkbox inline">
                                    <input type="checkbox" value="suplier" name="owner_type[]" id="owner_suplier" <?if($post_action=='EDIT' && $post['suplier']==1)echo 'checked="checked"';?> tabindex="4"> Suplier
                                </label>
                                <label class="checkbox inline">
                                    <input type="checkbox" value="partner" name="owner_type[]" id="owner_partner" <?if($post_action=='EDIT' && $post['partner']==1)echo 'checked="checked"';?> tabindex="5"> Partner
                                </label>
                            </div>
                        </div>

                        <div class="control-group">

                            <label class="control-label">Surname</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="surname" id="surname" value="<?if($post_action=='EDIT')echo $post['surname'];?>" tabindex="7">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Tax type</label>

                            <div class="controls docs-input-sizes">

                                <select class="span3" name="tax_type" id="tax_type" tabindex="9" class="required">
                                    <option value="0">- Please select</option>
                                    <option value="Insurance">Insurance</option>
                                    <option value="Local tax">Local tax</option>
                                </select>

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Birthplace</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="birthplace" id="birthplace" value="<?if($post_action=='EDIT')echo $post['birthplace'];?>" tabindex="11">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Citizenship</label>

                            <div class="controls docs-input-sizes">

                                <select class="span3" name="citizenship" id="citizenship" tabindex="13">
                                    <option value="0">- Please select</option>
                                    <option value="afghan">Afghan</option>
                                    <option value="albanian">Albanian</option>
                                    <option value="algerian">Algerian</option>
                                    <option value="american">American</option>
                                    <option value="andorran">Andorran</option>
                                    <option value="angolan">Angolan</option>
                                    <option value="antiguans">Antiguans</option>
                                    <option value="argentinean">Argentinean</option>
                                    <option value="armenian">Armenian</option>
                                    <option value="australian">Australian</option>
                                    <option value="austrian">Austrian</option>
                                    <option value="azerbaijani">Azerbaijani</option>
                                    <option value="bahamian">Bahamian</option>
                                    <option value="bahraini">Bahraini</option>
                                    <option value="bangladeshi">Bangladeshi</option>
                                    <option value="barbadian">Barbadian</option>
                                    <option value="barbudans">Barbudans</option>
                                    <option value="batswana">Batswana</option>
                                    <option value="belarusian">Belarusian</option>
                                    <option value="belgian">Belgian</option>
                                    <option value="belizean">Belizean</option>
                                    <option value="beninese">Beninese</option>
                                    <option value="bhutanese">Bhutanese</option>
                                    <option value="bolivian">Bolivian</option>
                                    <option value="bosnian">Bosnian</option>
                                    <option value="brazilian">Brazilian</option>
                                    <option value="british">British</option>
                                    <option value="bruneian">Bruneian</option>
                                    <option value="bulgarian">Bulgarian</option>
                                    <option value="burkinabe">Burkinabe</option>
                                    <option value="burmese">Burmese</option>
                                    <option value="burundian">Burundian</option>
                                    <option value="cambodian">Cambodian</option>
                                    <option value="cameroonian">Cameroonian</option>
                                    <option value="canadian">Canadian</option>
                                    <option value="cape verdean">Cape Verdean</option>
                                    <option value="central african">Central African</option>
                                    <option value="chadian">Chadian</option>
                                    <option value="chilean">Chilean</option>
                                    <option value="chinese">Chinese</option>
                                    <option value="colombian">Colombian</option>
                                    <option value="comoran">Comoran</option>
                                    <option value="congolese">Congolese</option>
                                    <option value="costa rican">Costa Rican</option>
                                    <option value="croatian">Croatian</option>
                                    <option value="cuban">Cuban</option>
                                    <option value="cypriot">Cypriot</option>
                                    <option value="czech">Czech</option>
                                    <option value="danish">Danish</option>
                                    <option value="djibouti">Djibouti</option>
                                    <option value="dominican">Dominican</option>
                                    <option value="dutch">Dutch</option>
                                    <option value="east timorese">East Timorese</option>
                                    <option value="ecuadorean">Ecuadorean</option>
                                    <option value="egyptian">Egyptian</option>
                                    <option value="emirian">Emirian</option>
                                    <option value="equatorial guinean">Equatorial Guinean</option>
                                    <option value="eritrean">Eritrean</option>
                                    <option value="estonian">Estonian</option>
                                    <option value="ethiopian">Ethiopian</option>
                                    <option value="fijian">Fijian</option>
                                    <option value="filipino">Filipino</option>
                                    <option value="finnish">Finnish</option>
                                    <option value="french">French</option>
                                    <option value="gabonese">Gabonese</option>
                                    <option value="gambian">Gambian</option>
                                    <option value="georgian">Georgian</option>
                                    <option value="german">German</option>
                                    <option value="ghanaian">Ghanaian</option>
                                    <option value="greek">Greek</option>
                                    <option value="grenadian">Grenadian</option>
                                    <option value="guatemalan">Guatemalan</option>
                                    <option value="guinea-bissauan">Guinea-Bissauan</option>
                                    <option value="guinean">Guinean</option>
                                    <option value="guyanese">Guyanese</option>
                                    <option value="haitian">Haitian</option>
                                    <option value="herzegovinian">Herzegovinian</option>
                                    <option value="honduran">Honduran</option>
                                    <option value="hungarian">Hungarian</option>
                                    <option value="icelander">Icelander</option>
                                    <option value="indian">Indian</option>
                                    <option value="indonesian">Indonesian</option>
                                    <option value="iranian">Iranian</option>
                                    <option value="iraqi">Iraqi</option>
                                    <option value="irish">Irish</option>
                                    <option value="israeli">Israeli</option>
                                    <option value="italian">Italian</option>
                                    <option value="ivorian">Ivorian</option>
                                    <option value="jamaican">Jamaican</option>
                                    <option value="japanese">Japanese</option>
                                    <option value="jordanian">Jordanian</option>
                                    <option value="kazakhstani">Kazakhstani</option>
                                    <option value="kenyan">Kenyan</option>
                                    <option value="kittian and nevisian">Kittian and Nevisian</option>
                                    <option value="kuwaiti">Kuwaiti</option>
                                    <option value="kyrgyz">Kyrgyz</option>
                                    <option value="laotian">Laotian</option>
                                    <option value="latvian">Latvian</option>
                                    <option value="lebanese">Lebanese</option>
                                    <option value="liberian">Liberian</option>
                                    <option value="libyan">Libyan</option>
                                    <option value="liechtensteiner">Liechtensteiner</option>
                                    <option value="lithuanian">Lithuanian</option>
                                    <option value="luxembourger">Luxembourger</option>
                                    <option value="macedonian">Macedonian</option>
                                    <option value="malagasy">Malagasy</option>
                                    <option value="malawian">Malawian</option>
                                    <option value="malaysian">Malaysian</option>
                                    <option value="maldivan">Maldivan</option>
                                    <option value="malian">Malian</option>
                                    <option value="maltese">Maltese</option>
                                    <option value="marshallese">Marshallese</option>
                                    <option value="mauritanian">Mauritanian</option>
                                    <option value="mauritian">Mauritian</option>
                                    <option value="mexican">Mexican</option>
                                    <option value="micronesian">Micronesian</option>
                                    <option value="moldovan">Moldovan</option>
                                    <option value="monacan">Monacan</option>
                                    <option value="mongolian">Mongolian</option>
                                    <option value="montenegrin">Montenegrin</option>
                                    <option value="moroccan">Moroccan</option>
                                    <option value="mosotho">Mosotho</option>
                                    <option value="motswana">Motswana</option>
                                    <option value="mozambican">Mozambican</option>
                                    <option value="namibian">Namibian</option>
                                    <option value="nauruan">Nauruan</option>
                                    <option value="nepalese">Nepalese</option>
                                    <option value="new zealander">New Zealander</option>
                                    <option value="ni-vanuatu">Ni-Vanuatu</option>
                                    <option value="nicaraguan">Nicaraguan</option>
                                    <option value="nigerien">Nigerien</option>
                                    <option value="north korean">North Korean</option>
                                    <option value="northern irish">Northern Irish</option>
                                    <option value="norwegian">Norwegian</option>
                                    <option value="omani">Omani</option>
                                    <option value="pakistani">Pakistani</option>
                                    <option value="palauan">Palauan</option>
                                    <option value="panamanian">Panamanian</option>
                                    <option value="papua new guinean">Papua New Guinean</option>
                                    <option value="paraguayan">Paraguayan</option>
                                    <option value="peruvian">Peruvian</option>
                                    <option value="polish">Polish</option>
                                    <option value="portuguese">Portuguese</option>
                                    <option value="qatari">Qatari</option>
                                    <option value="romanian">Romanian</option>
                                    <option value="russian">Russian</option>
                                    <option value="rwandan">Rwandan</option>
                                    <option value="saint lucian">Saint Lucian</option>
                                    <option value="salvadoran">Salvadoran</option>
                                    <option value="samoan">Samoan</option>
                                    <option value="san marinese">San Marinese</option>
                                    <option value="sao tomean">Sao Tomean</option>
                                    <option value="saudi">Saudi</option>
                                    <option value="scottish">Scottish</option>
                                    <option value="senegalese">Senegalese</option>
                                    <option value="serbian">Serbian</option>
                                    <option value="seychellois">Seychellois</option>
                                    <option value="sierra leonean">Sierra Leonean</option>
                                    <option value="singaporean">Singaporean</option>
                                    <option value="slovakian">Slovakian</option>
                                    <option value="slovenian">Slovenian</option>
                                    <option value="solomon islander">Solomon Islander</option>
                                    <option value="somali">Somali</option>
                                    <option value="south african">South African</option>
                                    <option value="south korean">South Korean</option>
                                    <option value="spanish">Spanish</option>
                                    <option value="sri lankan">Sri Lankan</option>
                                    <option value="sudanese">Sudanese</option>
                                    <option value="surinamer">Surinamer</option>
                                    <option value="swazi">Swazi</option>
                                    <option value="swedish">Swedish</option>
                                    <option value="swiss">Swiss</option>
                                    <option value="syrian">Syrian</option>
                                    <option value="taiwanese">Taiwanese</option>
                                    <option value="tajik">Tajik</option>
                                    <option value="tanzanian">Tanzanian</option>
                                    <option value="thai">Thai</option>
                                    <option value="togolese">Togolese</option>
                                    <option value="tongan">Tongan</option>
                                    <option value="trinidadian or tobagonian">Trinidadian or Tobagonian</option>
                                    <option value="tunisian">Tunisian</option>
                                    <option value="turkish">Turkish</option>
                                    <option value="tuvaluan">Tuvaluan</option>
                                    <option value="ugandan">Ugandan</option>
                                    <option value="ukrainian">Ukrainian</option>
                                    <option value="uruguayan">Uruguayan</option>
                                    <option value="uzbekistani">Uzbekistani</option>
                                    <option value="venezuelan">Venezuelan</option>
                                    <option value="vietnamese">Vietnamese</option>
                                    <option value="welsh">Welsh</option>
                                    <option value="yemenite">Yemenite</option>
                                    <option value="zambian">Zambian</option>
                                    <option value="zimbabwean">Zimbabwean</option>
                                </select>

                            </div>

                        </div>

                    </fieldset>

                </div>

            </div>    

        </div>


        <div class="group">

            <span class="group-title">CONTACT DATA</span>

            <div class="row">

                <div class="span6">         

                    <fieldset>

                        <div class="control-group">

                            <label class="control-label">Address</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="address" id="address" value="<?if($post_action=='EDIT')echo $post['address'];?>" tabindex="16">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Zip code</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="zip_code" id="zip_code" value="<?if($post_action=='EDIT')echo $post['zip_code'];?>"  tabindex="18">

                            </div>

                        </div>

                        <div class="control-group">
                            <label for="email" class="control-label">E-mail</label>
                            <div class="controls">
                                <div class="input-prepend">
                                    <span class="add-on">@</span><input type="text" size="16" id="email" class="span2" name="email" value="<?if($post_action=='EDIT')echo $post['email'];?>"  tabindex="20">
                                </div>

                            </div>
                        </div>

                        <div class="control-group">
                            <label for="phone" class="control-label">Telephone</label>
                            <div class="controls">
                                <input type="text" id="telephone" class="input-xlarge" name="telephone" value="<?if($post_action=='EDIT')echo $post['telephone'];?>"  tabindex="22">

                            </div>
                        </div>

                        <div class="control-group">
                            <label for="phone" class="control-label">Telefax</label>
                            <div class="controls">
                                <input type="text" id="telefax" class="input-xlarge" name="telefax" value="<?if($post_action=='EDIT')echo $post['telefax'];?>"  tabindex="24">

                            </div>
                        </div>

                    </fieldset>

                </div>

                <div class="span6">

                    <fieldset>

                        <div class="control-group">

                            <label class="control-label">City</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="city" id="city" value="<?if($post_action=='EDIT')echo $post['city'];?>"  tabindex="17">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Country</label>

                            <div class="controls docs-input-sizes">

                                <select class="span3" name="country" id="country"  tabindex="19">
                                    <option value="0">- Please select</option>
                                    <option value="Afghanistan">Afghanistan</option>
                                    <option value="Albania">Albania</option>
                                    <option value="Algeria">Algeria</option>
                                    <option value="American Samoa">American Samoa</option>
                                    <option value="Andorra">Andorra</option>
                                    <option value="Angola">Angola</option>
                                    <option value="Anguilla">Anguilla</option>
                                    <option value="Antarctica">Antarctica</option>
                                    <option value="Antigua And Barbuda">Antigua And Barbuda</option>
                                    <option value="Argentina">Argentina</option>
                                    <option value="Armenia">Armenia</option>
                                    <option value="Aruba">Aruba</option>
                                    <option value="Australia">Australia</option>
                                    <option value="Austria">Austria</option>
                                    <option value="Azerbaijan">Azerbaijan</option>
                                    <option value="Bahamas">Bahamas</option>
                                    <option value="Bahrain">Bahrain</option>
                                    <option value="Bangladesh">Bangladesh</option>
                                    <option value="Barbados">Barbados</option>
                                    <option value="Belarus">Belarus</option>
                                    <option value="Belgium">Belgium</option>
                                    <option value="Belize">Belize</option>
                                    <option value="Benin">Benin</option>
                                    <option value="Bermuda">Bermuda</option>
                                    <option value="Bhutan">Bhutan</option>
                                    <option value="Bolivia">Bolivia</option>
                                    <option value="Bosnia And Herzegovina">Bosnia And Herzegovina</option>
                                    <option value="Botswana">Botswana</option>
                                    <option value="Bouvet Island">Bouvet Island</option>
                                    <option value="Brazil">Brazil</option>
                                    <option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
                                    <option value="Brunei Darussalam">Brunei Darussalam</option>
                                    <option value="Bulgaria">Bulgaria</option>
                                    <option value="Burkina Faso">Burkina Faso</option>
                                    <option value="Burundi">Burundi</option>
                                    <option value="Cambodia">Cambodia</option>
                                    <option value="Cameroon">Cameroon</option>
                                    <option value="Canada">Canada</option>
                                    <option value="Cape Verde">Cape Verde</option>
                                    <option value="Cayman Islands">Cayman Islands</option>
                                    <option value="Central African Republic">Central African Republic</option>
                                    <option value="Chad">Chad</option>
                                    <option value="Chile">Chile</option>
                                    <option value="China">China</option>
                                    <option value="Christmas Island">Christmas Island</option>
                                    <option value="Cocos (keeling) Islands">Cocos (keeling) Islands</option>
                                    <option value="Colombia">Colombia</option>
                                    <option value="Comoros">Comoros</option>
                                    <option value="Congo">Congo</option>
                                    <option value="Congo, The Democratic Republic Of The">Congo, The Democratic Republic Of The</option>
                                    <option value="Cook Islands">Cook Islands</option>
                                    <option value="Costa Rica">Costa Rica</option>
                                    <option value="Croatia">Croatia</option>
                                    <option value="Cuba">Cuba</option>
                                    <option value="Cyprus">Cyprus</option>
                                    <option value="Czech Republic">Czech Republic</option>
                                    <option value="Denmark">Denmark</option>
                                    <option value="Djibouti">Djibouti</option>
                                    <option value="Dominica">Dominica</option>
                                    <option value="Dominican Republic">Dominican Republic</option>
                                    <option value="Ecuador">Ecuador</option>
                                    <option value="Egypt">Egypt</option>
                                    <option value="El Salvador">El Salvador</option>
                                    <option value="Equatorial Guinea">Equatorial Guinea</option>
                                    <option value="Eritrea">Eritrea</option>
                                    <option value="Estonia">Estonia</option>
                                    <option value="Ethiopia">Ethiopia</option>
                                    <option value="Falkland Islands (malvinas)">Falkland Islands (malvinas)</option>
                                    <option value="Faroe Islands">Faroe Islands</option>
                                    <option value="Fiji">Fiji</option>
                                    <option value="Finland">Finland</option>
                                    <option value="France">France</option>
                                    <option value="French Guiana">French Guiana</option>
                                    <option value="French Polynesia">French Polynesia</option>
                                    <option value="French Southern Territories">French Southern Territories</option>
                                    <option value="Gabon">Gabon</option>
                                    <option value="Gambia">Gambia</option>
                                    <option value="Georgia">Georgia</option>
                                    <option value="Germany">Germany</option>
                                    <option value="Ghana">Ghana</option>
                                    <option value="Gibraltar">Gibraltar</option>
                                    <option value="Greece">Greece</option>
                                    <option value="Greenland">Greenland</option>
                                    <option value="Grenada">Grenada</option>
                                    <option value="Guadeloupe">Guadeloupe</option>
                                    <option value="Guam">Guam</option>
                                    <option value="Guatemala">Guatemala</option>
                                    <option value="Guernsey">Guernsey</option>
                                    <option value="Guinea">Guinea</option>
                                    <option value="Guinea-bissau">Guinea-bissau</option>
                                    <option value="Guyana">Guyana</option>
                                    <option value="Haiti">Haiti</option>
                                    <option value="Heard Island And Mcdonald Islands">Heard Island And Mcdonald Islands</option>
                                    <option value="Honduras">Honduras</option>
                                    <option value="Hong Kong">Hong Kong</option>
                                    <option value="Hungary">Hungary</option>
                                    <option value="Iceland">Iceland</option>
                                    <option value="India">India</option>
                                    <option value="Indonesia">Indonesia</option>
                                    <option value="Iran, Islamic Republic Of">Iran, Islamic Republic Of</option>
                                    <option value="Iraq">Iraq</option>
                                    <option value="Ireland">Ireland</option>
                                    <option value="Isle Of Man">Isle Of Man</option>
                                    <option value="Israel">Israel</option>
                                    <option value="Italy">Italy</option>
                                    <option value="Jamaica">Jamaica</option>
                                    <option value="Japan">Japan</option>
                                    <option value="Jersey">Jersey</option>
                                    <option value="Jordan">Jordan</option>
                                    <option value="Kazakhstan">Kazakhstan</option>
                                    <option value="Kenya">Kenya</option>
                                    <option value="Kiribati">Kiribati</option>
                                    <option value="Korea, Democratic People's Republic Of">Korea, Democratic People's Republic Of</option>
                                    <option value="Korea, Republic Of">Korea, Republic Of</option>
                                    <option value="Kuwait">Kuwait</option>
                                    <option value="Kyrgyzstan">Kyrgyzstan</option>
                                    <option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
                                    <option value="Latvia">Latvia</option>
                                    <option value="Lebanon">Lebanon</option>
                                    <option value="Lesotho">Lesotho</option>
                                    <option value="Liberia">Liberia</option>
                                    <option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
                                    <option value="Liechtenstein">Liechtenstein</option>
                                    <option value="Lithuania">Lithuania</option>
                                    <option value="Luxembourg">Luxembourg</option>
                                    <option value="Macao">Macao</option>
                                    <option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option>
                                    <option value="Madagascar">Madagascar</option>
                                    <option value="Malawi">Malawi</option>
                                    <option value="Malaysia">Malaysia</option>
                                    <option value="Maldives">Maldives</option>
                                    <option value="Mali">Mali</option>
                                    <option value="Malta">Malta</option>
                                    <option value="Marshall Islands">Marshall Islands</option>
                                    <option value="Martinique">Martinique</option>
                                    <option value="Mauritania">Mauritania</option>
                                    <option value="Mauritius">Mauritius</option>
                                    <option value="Mayotte">Mayotte</option>
                                    <option value="Mexico">Mexico</option>
                                    <option value="Micronesia, Federated States Of">Micronesia, Federated States Of</option>
                                    <option value="Moldova">Moldova</option>
                                    <option value="Monaco">Monaco</option>
                                    <option value="Mongolia">Mongolia</option>
                                    <option value="Montenegro">Montenegro</option>
                                    <option value="Montserrat">Montserrat</option>
                                    <option value="Morocco">Morocco</option>
                                    <option value="Mozambique">Mozambique</option>
                                    <option value="Myanmar">Myanmar</option>
                                    <option value="Namibia">Namibia</option>
                                    <option value="Nauru">Nauru</option>
                                    <option value="Nepal">Nepal</option>
                                    <option value="Netherlands">Netherlands</option>
                                    <option value="Netherlands Antilles">Netherlands Antilles</option>
                                    <option value="New Caledonia">New Caledonia</option>
                                    <option value="New Zealand">New Zealand</option>
                                    <option value="Nicaragua">Nicaragua</option>
                                    <option value="Niger">Niger</option>
                                    <option value="Nigeria">Nigeria</option>
                                    <option value="Niue">Niue</option>
                                    <option value="Norfolk Island">Norfolk Island</option>
                                    <option value="Northern Mariana Islands">Northern Mariana Islands</option>
                                    <option value="Norway">Norway</option>
                                    <option value="Oman">Oman</option>
                                    <option value="Pakistan">Pakistan</option>
                                    <option value="Palau">Palau</option>
                                    <option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
                                    <option value="Panama">Panama</option>
                                    <option value="Papua New Guinea">Papua New Guinea</option>
                                    <option value="Paraguay">Paraguay</option>
                                    <option value="Peru">Peru</option>
                                    <option value="Philippines">Philippines</option>
                                    <option value="Pitcairn">Pitcairn</option>
                                    <option value="Poland">Poland</option>
                                    <option value="Portugal">Portugal</option>
                                    <option value="Puerto Rico">Puerto Rico</option>
                                    <option value="Qatar">Qatar</option>
                                    <option value="Romania">Romania</option>
                                    <option value="Russian Federation">Russian Federation</option>
                                    <option value="Rwanda">Rwanda</option>
                                    <option value="Saint Helena">Saint Helena</option>
                                    <option value="Saint Kitts And Nevis">Saint Kitts And Nevis</option>
                                    <option value="Saint Lucia">Saint Lucia</option>
                                    <option value="Saint Martin">Saint Martin</option>
                                    <option value="Saint Pierre And Miquelon">Saint Pierre And Miquelon</option>
                                    <option value="Saint Vincent And The Grenadines">Saint Vincent And The Grenadines</option>
                                    <option value="Samoa">Samoa</option>
                                    <option value="San Marino">San Marino</option>
                                    <option value="Sao Tome And Principe">Sao Tome And Principe</option>
                                    <option value="Saudi Arabia">Saudi Arabia</option>
                                    <option value="Senegal">Senegal</option>
                                    <option value="Serbia">Serbia</option>
                                    <option value="Seychelles">Seychelles</option>
                                    <option value="Sierra Leone">Sierra Leone</option>
                                    <option value="Singapore">Singapore</option>
                                    <option value="Slovakia">Slovakia</option>
                                    <option value="Slovenia">Slovenia</option>
                                    <option value="Solomon Islands">Solomon Islands</option>
                                    <option value="Somalia">Somalia</option>
                                    <option value="South Africa">South Africa</option>
                                    <option value="South Georgia And The South Sandwich Islands">South Georgia And The South Sandwich Islands</option>
                                    <option value="Spain">Spain</option>
                                    <option value="Sri Lanka">Sri Lanka</option>
                                    <option value="Sudan">Sudan</option>
                                    <option value="Suriname">Suriname</option>
                                    <option value="Svalbard And Jan Mayen">Svalbard And Jan Mayen</option>
                                    <option value="Swaziland">Swaziland</option>
                                    <option value="Sweden">Sweden</option>
                                    <option value="Switzerland">Switzerland</option>
                                    <option value="Syrian Arab Republic">Syrian Arab Republic</option>
                                    <option value="Taiwan, Province Of China">Taiwan, Province Of China</option>
                                    <option value="Tajikistan">Tajikistan</option>
                                    <option value="Tanzania, United Republic Of">Tanzania, United Republic Of</option>
                                    <option value="Thailand">Thailand</option>
                                    <option value="Timor-leste">Timor-leste</option>
                                    <option value="Togo">Togo</option>
                                    <option value="Tokelau">Tokelau</option>
                                    <option value="Tonga">Tonga</option>
                                    <option value="Trinidad And Tobago">Trinidad And Tobago</option>
                                    <option value="Tunisia">Tunisia</option>
                                    <option value="Turkey">Turkey</option>
                                    <option value="Turkmenistan">Turkmenistan</option>
                                    <option value="Turks And Caicos Islands">Turks And Caicos Islands</option>
                                    <option value="Tuvalu">Tuvalu</option>
                                    <option value="Uganda">Uganda</option>
                                    <option value="Ukraine">Ukraine</option>
                                    <option value="United Arab Emirates">United Arab Emirates</option>
                                    <option value="United Kingdom">United Kingdom</option>
                                    <option value="United States">United States</option>
                                    <option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
                                    <option value="Uruguay">Uruguay</option>
                                    <option value="Uzbekistan">Uzbekistan</option>
                                    <option value="Vanuatu">Vanuatu</option>
                                    <option value="Vatican City State">Vatican City State</option>
                                    <option value="Venezuela">Venezuela</option>
                                    <option value="Viet Nam">Viet Nam</option>
                                    <option value="Virgin Islands, British">Virgin Islands, British</option>
                                    <option value="Virgin Islands, U.s.">Virgin Islands, U.s.</option>
                                    <option value="Wallis And Futuna">Wallis And Futuna</option>
                                    <option value="Western Sahara">Western Sahara</option>
                                    <option value="Yemen">Yemen</option>
                                    <option value="Zambia">Zambia</option>
                                    <option value="Zimbabwe">Zimbabwe</option>
                                </select>

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Mobile Phone</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="mobile_phone" id="mobile_phone" value="<?if($post_action=='EDIT')echo $post['mobile_phone'];?>"  tabindex="21">

                            </div>

                        </div>

                        <div class="control-group">
                            <label for="phone" class="control-label">Telephone 2</label>
                            <div class="controls">
                                <input type="text" id="telephone2" class="input-xlarge" name="telephone2" value="<?if($post_action=='EDIT')echo $post['telephone2'];?>"  tabindex="23">

                            </div>
                        </div>

                    </fieldset>

                </div>

            </div>    

        </div>


        <div class="group">

            <span class="group-title">BANK</span>

            <div class="row">

                <div class="span6">         

                    <fieldset>

                        <div class="control-group">

                            <label class="control-label">Name</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" placeholder="Bank name" class="input-xlarge" name="bank_name" id="bank_name" value="<?if($post_action=='EDIT')echo $post['bank_name'];?>"  tabindex="25">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">SWIFT</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" placeholder="SWIFT" class="input-xlarge" name="swift" id="swift" value="<?if($post_action=='EDIT')echo $post['swift'];?>"  tabindex="27">

                            </div>

                        </div>

                    </fieldset>

                </div>

                <div class="span6">

                    <fieldset>

                        <div class="control-group">

                            <label class="control-label">Bank account number</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" placeholder="Bank account number" class="input-xlarge" name="bank_ac_number" id="bank_ac_number" value="<?if($post_action=='EDIT')echo $post['bank_ac_number'];?>"  tabindex="26">

                            </div>

                        </div>

                    </fieldset>

                </div>

            </div>    

        </div>


        <div class="group">

            <span class="group-title">OTHER DETAILS</span>

            <div class="row">

                <div class="span6">         

                    <fieldset>

                        <div class="control-group">

                            <label class="control-label">Contract type</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="contract_type" id="contract_type" value="<?if($post_action=='EDIT')echo $post['contract_type'];?>"  tabindex="28">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Accounting code</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="accounting_code" id="accounting_code" value="<?if($post_action=='EDIT')echo $post['accounting_code'];?>"  tabindex="30">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Due date (days)</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="due_date" id="due_date" value="<?if($post_action=='EDIT')echo $post['due_date'];?>"  tabindex="32">

                            </div>

                        </div>

                    </fieldset>

                </div>

                <div class="span6">

                    <fieldset>

                        <div class="control-group">

                            <label class="control-label">Default option period (days)</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="span1" name="default_option_period" id="default_option_period" value="<?if($post_action=='EDIT')echo $post['default_option_period'];?>"  tabindex="29">

                            </div>

                        </div>

                        <div class="control-group">

                            <label class="control-label">Contract nr.</label>

                            <div class="controls docs-input-sizes">

                                <input type="text" class="input-xlarge" name="contract_nr" id="contract_nr" value="<?if($post_action=='EDIT')echo $post['contract_nr'];?>"  tabindex="31">

                            </div>

                        </div>

                    </fieldset>

                </div>

            </div>    

        </div>

        <div id="validation_error"></div>

        <fieldset>

            <div class="form-actions">

                <img id="ajax-loading" class="ajax-loading" src="<?=base_url()?>assets/img/backgnds/loading.gif" style="visibility: hidden;">

                <button class="btn btn-primary" type="submit" tabindex="33" disabled="disabled">Save changes</button>
                <button class="btn" tabindex="34" id="cancel">Cancel</button>


            </div>

        </fieldset>


    </form>

</div>

<script>

    jQuery(document).ready(function() {       

            //check dropdown methot - valdation
            $.validator.addMethod("check_item_dropdown", function(value, element) {  
                    return this.optional(element) || value != 0  ;   
                }, "Please select an item from the dropdown list.");

            // Override default error message
            jQuery.validator.messages.required = "";   

            // Override generation of error label
            jQuery("#post").validate({

                    rules: {

                        //General
                        company_person: {required :true},
                        'owner_type[]': {required :true},
                        name: "required",                        
                        surname: "required",                        
                        personal_ID: "required",                                              
                        tax_type: { check_item_dropdown: true },
                        birthdate: "required",                        
                        birthplace: "required",                        
                        pasport_number: "required",                        
                        citizenship: { check_item_dropdown: true },                        
                        language: { check_item_dropdown: true },

                        //Contact data
                        address: "required",
                        city: "required",
                        zip_code: "required",
                        country: { check_item_dropdown: true },
                        email: {
                            required: true,
                            email: true
                        }, 
                        mobile_phone: "required",
                        telephone: "required",

                        //Bank
                        bank_name: "required",
                        bank_ac_number: "required",
                        swift: "required",

                        //Other details
                        contract_type: "required",
                        contract_nr: "required"

                    }, 

                    highlight: function(element) {

                        console.log(element.name)

                        if(element.id=='email' || element.name=='company_person' || element.name=='owner_type[]'){
                            $(element).parent().parent().parent().addClass("error");
                        }else{
                            $(element).parent().parent().addClass("error");
                        }

                    },
                    unhighlight: function(element) {

                        if(element.id=='email' || element.name=='company_person' || element.name=='owner_type[]'){
                            $(element).parent().parent().parent().removeClass("error");
                        }else{
                            $(element).parent().parent().removeClass("error");
                        }

                    },

                    submitHandler: function(form) {

                        $('button[type=submit]').attr('disabled', 'disabled');

                        $('#ajax-loading').css('visibility','visible');

                        var form = $("#post");
                        var form_data = form.serialize();

                        $.ajax({
                                url: base_url+'owners/submit_post',
                                dataType: 'json',
                                type: "POST",
                                data: form_data,
                                success: function (data, textStatus, xhr) {
                                    
                                    jQuery('#ajax-loading').css('visibility','hidden');

                                    if(data.action==true){

                                        jQuery('.loader').html(data.msg);

                                        // REDIRECT
                                        function promo_show(){
                                            window.location.href = base_url+'owners/view_all?post_type=<?=$post_type?>'; 
                                        }
                                        window.setTimeout(function() { promo_show(); }, 1001);

                                    }else{

                                        $('button[type=submit]').removeAttr('disabled');
                                        $('#validation_error').html(error(data.msg,'error'));
                                    }
                                },
                                error: function (xhr, textStatus, errorThrown) {
                                    alert('Error ocured...\n'+xhr+'\n'+textStatus+errorThrown+'\n');
                                    $('button[type=submit]').removeAttr('disabled'); 
                                    $('#ajax-loading').css('visibility','hidden');
                                }
                        });

                    },
                    errorPlacement: function(error, element){}
            });

            //helper function - alert
            function error(string,type)
            {
                html = '<div class="alert alert-'+type+' clearfix">'
                '<button type="button" class="close" data-dismiss="alert">&times;</button>'
                html+= string; 
                html+= '</div>';
                return html;  
            }

            // select dropdowns
            <?if($post_action=='EDIT'):?>            

                $("#tax_type").val('<?=$post['tax_type']?>');
                $("#citizenship").val('<?=$post['citizenship']?>');
                $("#sex").val('<?=$post['sex']?>');
                $("#language").val('<?=$post['language']?>');
                $("#country").val('<?=$post['country']?>');

                <?endif;?>

            // enable form submit button
            $('button[type=submit]').removeAttr('disabled'); 

            //cancel button
            $('#cancel').live('click',function(){
                    window.location.href = base_url+'owners/view_all?post_type=<?=$post_type?>'; 
                    return false;
            })

            //fill form with some data
            $('#fill_form').live('click',function(){

                    // General
                    $("#company_person-person").attr('checked','checked');
                    $("#owner_customer").attr('checked','checked');
                    $("#owner_suplier").attr('checked','checked');
                    $("#name").val('ivan');
                    $("#surname").val('kukic');
                    $("#personal_ID").val('123456');
                    $("#tax_type").val('Local tax');
                    $("#birthdate").val('01.08.1982');                
                    $("#birthplace").val('Banjaluka');
                    $("#pasport_number").val('AC37B6V');
                    $("#citizenship").val('montenegrin');
                    $("#sex").val('male');
                    $("#language").val('Montenegrin');

                    // Contact data
                    $("#address").val('Jovana Tomaševića');
                    $("#city").val('Bar');
                    $("#zip_code").val('85000');
                    $("#country").val('Montenegro');
                    $("#email").val('ikukic@yahoo.com');
                    $("#mobile_phone").val('069 069 982');
                    $("#telephone").val('312 324');
                    $("#telephone2").val('312 324');
                    $("#telefax").val('312 324');

                    // Bank
                    $("#bank_name").val('NLB Montenegro');
                    $("#bank_ac_number").val('530-20322-60');
                    $("#swift").val('u38s00sj');

                    // Other details
                    $("#contract_type").val('1 year');
                    $("#default_option_period").val('123');
                    $("#accounting_code").val('321');
                    $("#contract_nr").val('001-12');
                    $("#due_date").val('432');

            })

    });

</script>